import React, { useEffect } from 'react'
import { useLocation } from 'react-router-dom'
 
const ScrollToTop: React.FC<{ node?: HTMLElement }> = ({ node = window }) => {
  const { pathname } = useLocation()
 
  useEffect(() => {
    node.scrollTo(0, 0)
  }, [pathname])
 
  return null
}
 
export default ScrollToTop